using System.Collections.Generic;
using System.Linq;
using System;
using System.Xaml;

namespace SolutionOrchestrator
{
	public static class XamlHelper
	{
		public static string Save<T>(T data)
		{
			return XamlServices.Save(data);
		}

		public static T ParseXaml<T>(string serialized) where T : new()
		{
			try
			{
				if (!string.IsNullOrEmpty(serialized))
				{
					return (T)XamlServices.Parse(serialized);
				}
			}
			catch (Exception ex)
			{
				XTrace.XTrace.Exception(ex);
#if DEBUG
				MessageBox.Show(ex.Message);
#endif
			}
			return new T();
		}

	}
}